home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / network / ncsasock / neti_tcp.h < prev    next >
Text File  |  1996-07-05  |  2KB  |  72 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution is only permitted until one year after the first shipment
  6.  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
  7.  * binary forms are permitted provided that: (1) source distributions retain
  8.  * this entire copyright notice and comment, and (2) distributions including
  9.  * binaries display the following acknowledgement:  This product includes
  10.  * software developed by the University of California, Berkeley and its
  11.  * contributors'' in the documentation or other materials provided with the
  12.  * distribution and in all advertising materials mentioning features or use
  13.  * of this software.  Neither the name of the University nor the names of
  14.  * its contributors may be used to endorse or promote products derived from
  15.  * this software without specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  *
  20.  *    @(#)tcp.h    7.7 (Berkeley) 6/28/90
  21.  */
  22.  
  23. typedef    u_long    tcp_seq;
  24. /*
  25.  * TCP header.
  26.  * Per RFC 793, September, 1981.
  27.  */
  28. struct tcphdr {
  29.     u_short    th_sport;        /* source port */
  30.     u_short    th_dport;        /* destination port */
  31.     tcp_seq    th_seq;            /* sequence number */
  32.     tcp_seq    th_ack;            /* acknowledgement number */
  33. #if BYTE_ORDER == LITTLE_ENDIAN 
  34.     u_char    th_x2:4,        /* (unused) */
  35.         th_off:4;        /* data offset */
  36. #endif
  37. #if BYTE_ORDER == BIG_ENDIAN 
  38.     u_char    th_off:4,        /* data offset */
  39.         th_x2:4;        /* (unused) */
  40. #endif
  41.     u_char    th_flags;
  42. #define    TH_FIN    0x01
  43. #define    TH_SYN    0x02
  44. #define    TH_RST    0x04
  45. #define    TH_PUSH    0x08
  46. #define    TH_ACK    0x10
  47. #define    TH_URG    0x20
  48.     u_short    th_win;            /* window */
  49.     u_short    th_sum;            /* checksum */
  50.     u_short    th_urp;            /* urgent pointer */
  51. };
  52.  
  53. #define    TCPOPT_EOL    0
  54. #define    TCPOPT_NOP    1
  55. #define    TCPOPT_MAXSEG    2
  56.  
  57. /*
  58.  * Default maximum segment size for TCP.
  59.  * With an IP MSS of 576, this is 536,
  60.  * but 512 is probably more convenient.
  61.  * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
  62.  */
  63. #define    TCP_MSS    512
  64.  
  65. #define    TCP_MAXWIN    65535        /* largest value for window */
  66.  
  67. /*
  68.  * User-settable options (used with setsockopt).
  69.  */
  70. #define    TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
  71. #define    TCP_MAXSEG    0x02    /* set maximum segment size */
  72.